package com.itheima.web;

import com.itheima.entity.PageReq;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckItem;
import com.itheima.service.CheckItemService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {
    @Reference
    private CheckItemService checkItemService;
    // 保存\更新预约用户信息
    @PostMapping("/save")
    public Result save(@RequestBody CheckItem checkItem){
        return  new Result(checkItemService.saveOrUpdate(checkItem)) ;
    }
    //查询所有用户
    @GetMapping("/findAll")
    public Result findAll(){
        return new Result(checkItemService.list());
    }
    //根据id删除用户信息
    @GetMapping("/deleteById/{id}")
    public Result deleteById(@PathVariable("id") long id){
        return  new Result(checkItemService.deleteById(id)) ;
    }
    //分页查询用户信息
    @PostMapping("/findByPage")
    public Result findByPage(@RequestBody PageReq  pageReq){
       return new Result(checkItemService.page(pageReq));
    }

}
